#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int findMissingNumber(int nums[], int n) {
    int missing = n;

    for (int i = 0; i < n; i++) {
        missing ^= nums[i] ^ i;
    }

    return missing;
}

int main() {
    int nums[] = { 0, 1, 3, 4, 5 };
    int n = sizeof(nums) / sizeof(nums[0]);

    int missingNumber = findMissingNumber(nums, n);
    printf("Missing number: %d\n", missingNumber);

    return 0;
}
